﻿using SimpleESBCore.Implement.Datas;
using SimpleESBCore.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinEsbClint
{
    public class WinLog:ILog
    {
        TextBox textBox;
        public WinLog(TextBox textBox)
        {
            this.textBox = textBox;
        }
        public void LogInfo(LogInfoData logInfoData)
        {
            if (textBox.InvokeRequired)
            {
                textBox.Invoke(new Action(() =>
                {
                    textBox.Text += logInfoData.LogMessage + "\r\n";
                }));
            }
            else
            {
                textBox.Text += logInfoData.LogMessage + "\r\n";
            }
        }
    }
}
